package com.serkol.driving.learning.wx.handler;

import com.serkol.driving.learning.wx.builder.TextBuilder;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author Binary Wang(https://github.com/binarywang)
 */
@Component
public class ScanHandler extends AbstractHandler {

    @Override
    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMpXmlMessage, Map<String, Object> map,
                                    WxMpService wxMpService, WxSessionManager wxSessionManager) throws WxErrorException {
    /*    System.out.println("Scan Utils");
        System.out.println(wxMpXmlMessage.getToUser()+"--"+wxMpXmlMessage.getFromUser());
        System.out.println(wxMpXmlMessage);
        WxMpXmlOutTextMessage wxMpXmlOutMessage=new WxMpXmlOutTextMessage();
        wxMpXmlOutMessage.setContent("成功");
     //   wxMpXmlOutMessage.toEncryptedXml(wxMpService.getWxMpConfigStorage());
        wxMpXmlOutMessage.setFromUserName(wxMpXmlMessage.getFromUser());*/

        // 扫码事件处理
        return new TextBuilder().build("成功",wxMpXmlMessage,wxMpService);
    }
}
